<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<title>currentColor</title>
<meta name="description" content="CSS3参考手册之: currentColor" />
<meta name="keywords" content="currentColor, css3取值, css3, css3参考手册" />
<meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" />
<meta name="robots" content="all" />
<!--[if lte IE 8]>
<script src="../../js/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="../../skin/article.css" />
</head>
<body>
<nav id="guide" class="g-mod">
	<div class="from">
		<a href="http://css.doyoe.com/" target="_blank">CSS3参考手册</a>
		<span>&#187;</span>
		<a href="../index.htm">取值与单位列表</a>
		<span>&#187;</span>
		<a href="index.htm" id="category" rel="values/color" name="currentColor">颜色值</a>
		<span>&#187;</span>
	</div>
	<div class="to">
		<span class="label">相关内容：</span>
		<div class="g-combobox g-transition">
			<a href="?" class="g-transition target">
				<strong>角度值与单位参考</strong>
				<span>选择其它项<!--[if lte IE 7]><ins>IE7 and earlier, Get to die</ins><![endif]--></span>
			</a>
			<div class="g-transition list">
				<ul>
					<!-- 插入分类快速导航 -->
				</ul>
			</div>
		</div>
	</div>
</nav>
<header id="hd">
	<section id="title" class="g-mod">
		<h1 class="tit">currentColor</h1>
		<ul class="info">
			<li><strong>版本：CSS3</strong></li>
		</ul>
		<!-- 插入浏览器信息 -->
	</section>
</header>
<section id="bd">
	<section id="intro" class="g-mod g-attr">
		<h2 class="tit">说明：</h2>
		<div class="cont">
			<p>在CSS1和CSS2中定义了<a href="../../properties/border/border-color.htm" class="g-property">border-color</a>属性的默认值是<a href="../../properties/color/color.htm" class="g-property">color</a>属性的值，但却没有为此定义一个相应的关键字。</p>
			<p>这个问题在 SVG 中被意识到了，于是在 SVG 1.0 中引入了<span class="g-value">currentColor</span>关键字。</p>
			<p>在CSS3中扩展了颜色值包含<span class="g-value">currentColor</span>关键字，并用于所有接受颜色的属性上。</p>
			<strong><span class="g-value">currentColor</span>是 <a href="../../properties/color/color.htm" class="g-property">color</a> 属性的值，具体意思是指：<span class="g-value">currentColor</span>关键字的使用值是<a href="../../properties/color/color.htm" class="g-property">color</a>属性值的计算值。</strong>
			<ul>
				<li>如果<span class="g-value">currentColor</span>关键字被应用在<a href="../../properties/color/color.htm" class="g-property">color</a>属性自身，则相当于是<code class="g-code">color: inherit</code>。</li>
				<li>
					<p>上述这些话都是什么意思呢？先看个例子</p>
					<div class="gquote">
						<p class="gquote-tit"><strong>示例代码：</strong></p>
						<div class="gquote-cont">
							<blockquote class="code"><code><xmp>div {
	border: 1px solid;
	color: red;
}</xmp></code></blockquote>
						</div>
						<div class="gquote-info">
							<p>如果你能立马知道上述代码的运行结果，那么就差不多理解 currentColor 关键字的意思了。</p>
							<p>上述代码将会让div拥有一个红色的边框，这就解释了 <a href="../../properties/border/border-color.htm">border-color</a> 属性的默认值是 <a href="../../properties/color/color.htm">color</a> 属性的值；</p>
							<p>如果将上述代码中的color属性定义删除，那么边框的颜色将取决于父元素的 <a href="../../properties/color/color.htm">color</a> 计算值，因为 <a href="../../properties/color/color.htm">color</a> 拥有继承性；</p>
						</div>
					</div>
				</li>
			</ul>
		</div>
	</section>
	<section id="compatible" class="g-mod g-attr">
		<h2 class="tit">兼容性：</h2>
		<div class="cont">
			<ul class="support-type">
				<li><span class="support">浅绿</span> = 支持</li>
				<li><span class="unsupport">红色</span> = 不支持</li>
				<li><span class="partsupport">粉色</span> = 部分支持</li>
			</ul>
			<table class="g-data">
				<thead>
					<tr>
						<th>IE</th>
						<th>Firefox</th>
						<th>Chrome</th>
						<th>Safari</th>
						<th>Opera</th>
						<th>iOS Safari</th>
						<th>Android Browser</th>
						<th>Android Chrome</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td class="unsupport">6.0-8.0 <sup><a href="#support1">#1</a></sup></td>
						<td class="support" rowspan="2">2.0+</td>
						<td class="support" rowspan="2">4.0+</td>
						<td class="support" rowspan="2">4.0+</td>
						<td class="support" rowspan="2">3.5+</td>
						<td class="support" rowspan="2">3.2+</td>
						<td class="support" rowspan="2">2.1+</td>
						<td class="support" rowspan="2">18.0+</td>
					</tr>
					<tr>
						<td class="support">9.0+</td>
					</tr>
				</tbody>
			</table>
			<ol class="support-info">
				<li id="support1">不支持<span class="g-value">currentColor</span>关键字，但支持以不定义该值的方式达到相同的效果；</li>
			</ol>
		</div>
	</section>
</section>
<footer id="ft">
	<aside id="rights" class="g-mod">
		<!-- 插入浏览器及版权信息 -->
	</aside>
</footer>
<script src="../../js/jquery.js"></script>
<script src="../../js/inner.js"></script>
</body>
</html>